using System;
using System.Collections.Generic;

namespace Blog.Domain.Repositories
{
  public class PostRepository : IPostRepository
  {
    private readonly List<IPost> posts;

    public PostRepository(List<IPost> posts)
    {
      this.posts = posts;
    }

    public IEnumerable<IPost> FindAllPostsPublishedOn(DateTime date)
    {
      foreach (var post in posts)
      {
        if (post.DateWasPublished == date)
        {
          yield return post;
        }
      };
    }
  }
}